/*
 * @lc app=leetcode.cn id=1389 lang=typescript
 *
 * [1389] 按既定顺序创建目标数组
 */

// @lc code=start
function createTargetArray(nums: number[], index: number[]): number[] {
    let target: number[] = [];
    for (let i = 0; i < nums.length; i++) {
        const element = nums[i];
        const key = index[i];
        target.splice(key, 0, element);
    }
    return target;
}
// @lc code=end
